<template>
	<view class="content">
		<view class="top" v-if="data.mobile">
			<view class="information d-f">
				<image class="head" src="/static/logo.png" alt="" />
				<label class="cff f16 f-w">{{data.username}}</label>
				<label class="cff f14">{{data.mobile}}</label>
				<image v-if="data.cert_status == 1" class="rz" src="/static/yrz.png" alt="" />
				<image @click="certification" v-if="data.cert_status == 0" class="rz" src="/static/wrz.png" alt="" />
				<image @click="certification" v-if="data.cert_status == 3" class="rz" src="/static/wtg.png" alt="" />
				<image @click="certification" v-if="data.cert_status == 2" class="rz" src="/static/shz.png" alt="" />
			</view>
			<view class="balance p-r" @click="menu('/pages/transaction_details/transaction_details?money='+data.created_by)">
				<view class="c1a f14 balance_l">
					余额
				</view>
				<view class="f40 f-w c1a balance_money">
					￥{{data.created_by}}
				</view>
				<view class="p-a d-f c1a f14">
					<image class="protect" src="/static/protect.png" alt="" />
					安全保障中
				</view>
			</view>
		</view>
		<view v-if="data.mobile" class="operation d-f j-b">
			<view :class="[sign != 0 ?'p-r signnumber':'']" @click="menu('/pages/registration/registration?status=0')">
				<image class="operations" src="/static/sh.png" alt="" />
				<view class="f14 c1a">
					已报名
				</view>
			</view>
			<view class="" @click="menu('/pages/registration/registration?status=1')">
				<image class="operations" src="/static/tk.png" alt="" />
				<view class="f14 c1a">
					已面签
				</view>
			</view>
			<view class="" @click="menu('/pages/registration/registration?status=2')">
				<image class="operations" src="/static/fu.png" alt="" />
				<view class="f14 c1a">
					已离职
				</view>
			</view>
		</view>
		<view v-if="data.mobile" class="buts cff t-c f14" @click="logout">
			退出登录
		</view>
		<view v-if="data.mobile" class="buts butss cff t-c f14" @click="logouts">
			注销
		</view>
		<view class="t-c null" v-if="!token">
			<image src="/static/null.png" mode="widthFix"></image>
			<text v-if="token">暂无内容</text>
		</view>
		<view v-if="!data.mobile" class="buts_ cff t-c f14" @click="log">
			立即登录
		</view>
	</view>
</template>

<script>
	import unis from '@/utils/util.js'
	export default {
		data() {
			return {
				data:[],
				token:'',
				sign:0
			}
		},
		onShow() {
			var that = this
			that.token = uni.getStorageSync('token')
			unis.getData('/api/member/info', 'get', {
				
			}, function (res) {
				if(res.code == 200){
					that.data= res.data
				}else{
					that.data = []
				}
			});
			unis.getData('/api/member/message/unread', 'get', {
			}, function (res) {
				if(res.code == 200){
					that.sign = res.data.sign_up_count
				}
			});
		},
		methods: {
			logouts(){
				uni.showLoading({
					title: '正在注销'
				});
				setTimeout(function () {
					uni.hideLoading();
					uni.reLaunch({
						url: '/pages/index/index',
					})
					uni.clearStorageSync()
				}, 2000);
			},
			log(){
				uni.reLaunch({
					url: '/pages/index/index',
				})
				uni.clearStorageSync()
			},
			certification(e){
				uni.navigateTo({
					url:'/pages/certification/certification'
				})
			},
			menu(e){
				uni.navigateTo({
					url:e
				})
			},
			logout(){
				uni.showModal({
					title: '温馨提示',
					content: '确定要退出登录吗',
					success: function (res) {
						if (res.confirm) {
							uni.reLaunch({
								url: '/pages/index/index',
							})
						  uni.clearStorageSync()
						} else if (res.cancel) {
							
						}
					}
				});

			}
		}
	}
</script>

<style lang="scss" scoped>
.top{
	height: 132px;
	background: linear-gradient( 180deg, #2D73FF 0%, rgba(45,115,255,0) 100%);
	.information{
		padding: 10px 16px 5px 16px;
		.head{
			width: 27px;
			height: 27px;
			border: 3px solid #fff;
			border-radius: 50%;
			margin-right: 7px;
		}
		.rz{
			width: 57px;
			height: 28px;
			margin-left: 8px;
		}
	}
	.balance{
		width: 718rpx;
		height: 238rpx;
		background-image: url('http://lgd.365linghuo.cn/uploads/images/beijing.png');
		background-size: 100%;
		background-repeat: no-repeat;
		margin-left: 10px;
		.balance_l{
			padding: 21px 0 0 30px;
		}
		.balance_money{
			padding: 13px 0 0 23px;
		}
		.p-a{
			right: 32px;
			top: 22px;
			.protect{
				width: 30px;
				height: 30px;
			}
		}
	}
}
.operation{
	margin: 50px 16px;
	padding: 15px 36px;
	background-color: #fff;
	border-radius: 4px 4px 4px 4px;
	.operations{
		width: 44px;
		height: 44px;
	}
}
.buts{
	width: 688rpx;
	margin:94px 16px 10px 16px;
	height: 45px;
	background: linear-gradient( 270deg, #36A2FC 0%, #2D73FF 100%);
	border-radius: 4px 4px 4px 4px;
	line-height: 45px;
	position: fixed;
	bottom: 80px;
}
.butss{
	background: #fff;
	bottom: 30px;
	color: #333;
}
.buts_{
	width: 688rpx;
	height: 45px;
	background: linear-gradient( 270deg, #36A2FC 0%, #2D73FF 100%);
	border-radius: 4px 4px 4px 4px;
	line-height: 45px;
	position: fixed;
	bottom: 50%;
	left: 50%;
	transform: translate(-50%,-50%);
}
.signnumber{
	&:after{
		content: '';
		position: absolute;
		width: 10px;
		height: 10px;
		border-radius: 50%;
		background-color: red;
		right: 0px;
		top: 0px;
	}
}
</style>
